package product.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import product.domain.CategoryBrandRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
 * @author panghu
 * @description 针对表【pms_category_brand_relation(品牌分类关联)】的数据库操作Mapper
 * @createDate 2023-03-04 21:03:08
 * @Entity src.main.java.product.domain.CategoryBrandRelation
 */
@Mapper
public interface CategoryBrandRelationMapper extends BaseMapper<CategoryBrandRelation> {


    @Select("select * from mall_pms.pms_category_brand_relation where brand_id=#{brandId}")
    List<CategoryBrandRelation> selectListByBrandId(Long brandId);


    /**
     * 根据品牌id更新品牌名
     *
     * @param brandId
     * @param name
     * @return
     */
    @Update("update mall_pms.pms_category_brand_relation set brand_name=#{name} where brand_id=#{brandId}")
    boolean updateBrandNameByBrandId(Long brandId, String name);

    /**
     * 根据分类id，修改分类名称
     *
     * @param catId
     * @param name
     */
    @Update("update mall_pms.pms_category_brand_relation set catelog_name=#{name} where catelog_id=#{catId}")
    void updateCatNameByCatId(Long catId, String name);
}




